from math import pi

degToRad = pi / 180.
radToDeg = 180. / pi

#x = enum('XX', 'XY', 'XZ')
def enum(*sequential, **named):
    enums = dict(zip(sequential, range(len(sequential))), **named)
    return type('Enum', (), enums)
#x = flags(A=1, B=2, C=4, D=8, BD=10)
def flags(**flags):
    return type('Enum', (), flags)

def dist(v1, v2):
	"""Distance between two Vector3s"""
	return math.sqrt((v2.x - v1.x)**2 + (v2.y - v1.y)**2 + (v2.z - v1.z)**2)
def distSq(v1, v2):
	"""Squared distance between two Vector3s - This is preferable if possible, to avoid the square root"""
	return (v2.x - v1.x)**2 + (v2.y - v1.y)**2 + (v2.z - v1.z)**2

def clamp(val, bmin, bmax):
	"""Return a limited val between a minimum and maximum boundary, inclusive"""
	return max(min(val, bmax), bmin)